package edu.ucollege.android;

import edu.ucollege.android.R;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.GridView;
import android.widget.ImageView;

public class ImageAdapter extends BaseAdapter {
	private Context mContext;
	public Integer[] mThumbIds = {
			R.drawable.icon_meal, 		R.drawable.bible,
			R.drawable.clubs,			R.drawable.contacts,
			R.drawable.maps,			R.drawable.moodle,
			R.drawable.newspaper_icon,	R.drawable.sunrise,
			R.drawable.barcode
	};
	
	public ImageAdapter(Context c){
		mContext = c;
	}
	
	public int getCount() {
		return mThumbIds.length;
	}

	public Object getItem(int position) {
		return mThumbIds[position];
	}

	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return 0;
	}

	public View getView(int position, View convertView, ViewGroup parent) {
		ImageView imageView = new ImageView(mContext);
        imageView.setImageResource(mThumbIds[position]);
        imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
        imageView.setLayoutParams(new GridView.LayoutParams(140, 140));
		return imageView;
	}

}
